import { createApp } from 'vue'
import App from './App.vue'
import { setupAuthority } from './hooks'
import router, { setupRouter } from './router'
import { setupStore } from './store'
// import { setupSentry } from './sentry'
import { XApplication } from '@/components/x-application'

import '@/assets/styles/index.scss'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

const appProvider = createApp(XApplication)
// 优先挂载一下 Provider 解决路由守卫，Axios中可使用，Dialog，Message 等之类组件
appProvider.mount('#appProvider', true)

const app = createApp(App)
app.use(ElementPlus)
// 挂载sentry
// setupSentry(app)
// 挂载vuex状态管理
setupStore(app)
// 挂载router
setupRouter(app)
// 挂载权限
setupAuthority(app)
// 路由准备就绪后挂载APP实例
router.isReady().then(() => app.mount('#app'))
